#ifndef A
#arch:=i386
#else
#arch:=$(A)
#endif

SHELL:=/bin/sh

MAKE:=gmake
MAKEOPT:=-C

com_mk_dir:=../mk
com_mk_header:=$(com_mk_dir)/com_mk_header.mk

subdir:=lib boot monitor kernel #server driver test

#export arch
export MAKE
export MAKEOPT

export com_mk_dir
export com_mk_header

.PHONY: world $(subdir) clean

world: $(subdir)

$(subdir):
	$(MAKE) $(MAKEOPT) $@

clean:
	@for d in $(subdir);    \
	do    \
	   (cd $$d;     \
	   rm -f $$(echo $$(find . -name "*.c") | sed -e 's/\.c/\.s/g');   \
	   rm -f $$(find . -name "*.o");)   \
	done
	
	rm -f ./lib/libc.a
	rm -f ./lib/libsys.a
			        